package com.base.control;


import android.content.Context;
import android.view.View;
import android.view.animation.AnimationUtils;

import com.base.framework.R;

public class VisibleControl {
	public static void bottomIn(View view, Context context) {
		view.setAnimation(AnimationUtils.loadAnimation(context, R.anim.anim_bottom_in));
		view.setVisibility(View.VISIBLE);
	}
	public static void bottomOut(View view, Context context) {
		view.setAnimation(AnimationUtils.loadAnimation(context, R.anim.anim_bottom_out));
		view.setVisibility(View.GONE);
	}
	public static void topIn(View view, Context context) {
		view.setAnimation(AnimationUtils.loadAnimation(context, R.anim.anim_top_in));
		view.setVisibility(View.VISIBLE);
	}
	public static void topOut(View view, Context context) {
		view.setAnimation(AnimationUtils.loadAnimation(context, R.anim.anim_top_out));
		view.setVisibility(View.GONE);
	}
    public static void topOutHeader(View view, Context context) {
        view.startAnimation(AnimationUtils.loadAnimation(context, R.anim.top_out_header));
    }
    public static void topInHeader(View view, Context context) {
        view.startAnimation(AnimationUtils.loadAnimation(context, R.anim.top_in_header));
    }
    public static void topOutGone(View view, Context context) {
        view.setAnimation(AnimationUtils.loadAnimation(context, R.anim.anim_top_out));
        view.setVisibility(View.GONE);
    }

    public static void fadeIn(View view, Context context) {
        view.setAnimation(AnimationUtils.loadAnimation(context, R.anim.fade_in));
        view.setVisibility(View.VISIBLE);
    }

    public static void fadeOut(View view, Context context) {
        view.setAnimation(AnimationUtils.loadAnimation(context, R.anim.fade_out));
        view.setVisibility(View.INVISIBLE);
    }
    public static void fadeOutGONE(View view, Context context) {
        view.setAnimation(AnimationUtils.loadAnimation(context, R.anim.fade_out));
        view.setVisibility(View.GONE);
    }
    public static void leftIn(View view, Context context) {
        view.setAnimation(AnimationUtils.loadAnimation(context, R.anim.slide_in_left));
        view.setVisibility(View.VISIBLE);
    }
    public static void leftOut(View view, Context context) {
        view.setAnimation(AnimationUtils.loadAnimation(context, R.anim.slide_out_left));
        view.setVisibility(View.INVISIBLE);
    }
    public static void rightIn(View view, Context context) {
        view.setAnimation(AnimationUtils.loadAnimation(context, R.anim.slide_in_right));
        view.setVisibility(View.VISIBLE);
    }
    public static void rightOut(View view, Context context) {
        view.setAnimation(AnimationUtils.loadAnimation(context, R.anim.slide_out_right));
        view.setVisibility(View.INVISIBLE);
    }

    public static void rotateOut(View view, Context context) {
        if(context != null) {
            view.setAnimation(AnimationUtils.loadAnimation(context, R.anim.rotate));
            view.setVisibility(View.INVISIBLE);
        }
    }
}
